import { constantRoutes, asyncRoutes } from '@/router/index'
const state = {
  menus: []
}
const mutations = {
  setRoutes(state, data) {
    state.menus = [...constantRoutes, ...data]
  }
}
const actions = {
  getPermisson(store, data) {
    const res = asyncRoutes.filter(item => {
      return data.includes(item.name)
    })
    store.commit('setRoutes', res)
    return res
  }
}
export default {
  namespaced: true,
  actions,
  state,
  mutations
}
